﻿Imports Microsoft.Xna.Framework

Namespace Global.Runa.Resources.ResourceManager

#If (Not WINDOWS_PHONE) And (Not NETFX_CORE) Then
    <Serializable>
    Public MustInherit Class ResourceObjectBase
#Else
    Public MustInherit Class ResourceObjectBase
#End If
        Implements IDisposable

        Public Property Name() As String
        Public Property FileName() As String
        Public Property IsLoaded() As Boolean

        Public Sub New()
            Me.Name = ""
            Me.FileName = ""
            Me.IsLoaded = False
        End Sub

        Public Sub New(ByVal name As String, ByVal fileName As String)
            Me.Name = name
            Me.FileName = fileName
            Me.IsLoaded = False
        End Sub

        Public MustOverride Function Load(ByVal g As Game) As Boolean

#Region "IDisposable Support"
        Private disposedValue As Boolean ' To detect redundant calls

        ' IDisposable
        Protected Overridable Sub Dispose(disposing As Boolean)
            If Not Me.disposedValue Then
                If disposing Then
                    ' TODO: dispose managed state (managed objects).
                End If
                ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
                ' TODO: set large fields to null.
            End If
            Me.disposedValue = True
        End Sub

        ' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources.
        'Protected Overrides Sub Finalize()
        '    ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
        '    Dispose(False)
        '    MyBase.Finalize()
        'End Sub

        ' This code added by Visual Basic to correctly implement the disposable pattern.
        Public Sub Dispose() Implements IDisposable.Dispose
            ' Do not change this code.  Put cleanup code in Dispose(disposing As Boolean) above.
            Dispose(True)
            GC.SuppressFinalize(Me)
        End Sub
#End Region

    End Class

End Namespace